import { createRouter, createWebHistory} from 'vue-router'
import type{ RouteRecordRaw} from 'vue-router'
export const Layout = () => import("../layout/layout.vue");

// 白名单路由
export const whiteRouterList: RouteRecordRaw[] = [
	{
		path: "/login",
		component: () => import("../views/login/login.vue"),
		meta: { hidden: true },
	},
  {
    path: '/mobileLogin',
    component: () => import("../mobile/login/mobile-login.vue"),
    meta: { hidden: true },
  }
];
const constantRoutes: RouteRecordRaw[] = [
  {
    path: '/',
    name: '/',
    component: Layout,
    children:[
      {
        path:'/user',
        name:'user',
        meta: {title: '设置 / 用户管理'},  
        component: () => import('../views/UserIOrganize.vue')
      },
      {
        path:'/knowledgebase',
        name:'knowledgebase',
        meta: {title: '知识库'},  
        component: () => import('../layout/components/knowledge-base/knowledge-base.vue')
      },
      {
        path:'/historicaltalk',
        name:'historicaltalk',
        meta: {title: '历史会话'},  
        component: () => import('../views/HistoricalTalk.vue')
      },
      {
        path:'/sysInstall',
        name:'sysInstall',
        meta: {title: '设置 / 系统设置'},
        component: () => import('../views/SysInstall.vue'),
      },
      {
        path:'/intenTell',
        name:'intenTell',
        meta: {title: '通用示例 / 意图识别'},  
        component: () => import('../views/currentdemo/IntentTell.vue')
      },
      {
        path:'/contentSummary',
        name:'contentSummary',
        meta: {title: '通用示例 / 内容总结'},  
        component: () => import('../views/currentdemo/ContentSummary.vue')
      },
      {
        path:'/serviceExample',
        name:'serviceExample',
        meta: {title: '客服示例 / 表单预填'},  
        component: () => import('../views/customer-example/service-example/service-example.vue')
      },
      {
        path:'/aiSession',
        name:'aiSession',
        meta: {title: 'AI客服'},  
        component: () => import('../views/customer-example/ai-session/ai-session.vue')
      },
      {
        path:'/contentClassify',
        name:'contentClassify',
        meta: {title: '通用示例 / 内容归类'},  
        component: () => import('../views/currentdemo/ContentClassify.vue')
      },
      {
        path:'/reportAide',
        name:'reportAide',
        meta: {title: '通用示例 / 报表助手'},  
        component: () => import('../views/currentdemo/ReportAide.vue')
      },
      {
        path:'/entityExtract',
        name:'entityExtract',
        meta: {title: '通用示例 / 实体提取'},  
        component: () => import('../views/currentdemo/EntityExtract.vue')
      },
      {
        path:'/auxiliaryanswer',
        name:'auxiliaryanswer',
        meta: {title: '客服示例 / 辅助回答'},  
        component: () => import('../views/customer-example/auxiliary-answer/auxiliary-answer.vue')
      },
      {
        path:'/customertrain',
        name:'customertrain',
        meta: {title: '客服示例 / 客服训练'},  
        component: () => import('../views/customer-example/customer-train/customer-train.vue')
      },
      {
        path:'/artificial',
        name:'artificial',
        meta: {title: '客服示例 / 转人工'},  
        component: () => import('../views/customer-example/artificial/artificial.vue')
      },
      {
        path:'/cardSlotAskReply',
        name:'cardSlotAskReply',
        meta: {title: '客服示例 / 卡槽式反问'},  
        component: () => import('../views/customer-example/card-slot-ask-reply/card-slot-ask-reply.vue')
      },
      {
        path:'/custServiceQualityText',
        name:'custServiceQualityText',
        meta: {title: '客服示例 / 智能客服质检'},  
        component: () => import('../views/customer-example/cust-service-quality-test/cust-service-quality-test.vue')
      },
    ]
  },
  {
    path: '/mobile',
    name: 'mobile',//移动端首页
    component: () => import("../mobile/home/home.vue"),
  },
  {
    path:'/aicustomer',
    name:'aicustomer',//h5 AI对话页
    component: () => import("../components/mobile-ai/mobile-ai.vue"),
  },
  {
    path:'/reqort',
    name:'reqort',//h5 智能报表
    component: () => import("@/mobile/view/Intelligent-report/reqort.vue"),
  },
  {
    path:'/mobconter',
    name:'mobconter',//h5 内容总结
    component: () => import("@/mobile/view/content-summary/content-summary.vue"),
  },
  {
    path:'/intention',
    name:'intention',//h5 总结结果
    // meta: { keepAlive: true },
    component: () => import("@/mobile/view/content-summary/components/intention-distinguish.vue"),
  },
  {
    path:'/mobIntentDiscern',
    name:'mobIntentDiscern', //意图识别
    component: () => import("../mobile/view/currentdemo/mobileIntentDiscern.vue"),
  },
  {
    path:'/mobContentClass',
    name:'mobContentClass', //内容归类
    component: () => import("../mobile/view/currentdemo/mobileContentClass.vue"),
  },
  {
    path:'/mobEntityDraw',
    name:'mobEntityDraw', //实体提取
    component: () => import("../mobile/view/currentdemo/mobileEntityDraw.vue"),
  },
  {

    path:'/training',
    name:'training',//h5 AI客服训练
    component: () => import("@/mobile/view/customer-training/customer-training.vue"),
  },


];
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
	routes: [...whiteRouterList, ...constantRoutes],
  	// 刷新时，滚动条位置还原
	scrollBehavior: () => ({ left: 0, top: 0 }),
})

/**
 * 重置路由
 */
export function resetRouter() {
	router.replace({ path: "/login" });
	// router.replace({ path: "/mobileLogin" });
}

export default router
